//
//  SearchFootView.m
//  StationManager
//
//  Created by 泽华伟业 on 17/3/22.
//  Copyright © 2017年 Helong. All rights reserved.
//

#import "SearchFootView.h"

@interface SearchFootView ()

@property (nonatomic,strong) UIButton *prevButton;

@property (nonatomic,strong) UIButton *nextButton;



@end

@implementation SearchFootView

- (instancetype)init
{
    self = [super init];
    if (self) {
        _prevButton = [[UIButton alloc]init];
        _nextButton = [[UIButton alloc]init];
        _pageLable = [[UILabel alloc]init];
        [self addSubview:_prevButton];
        [self addSubview:_pageLable];
        [self addSubview:_nextButton];
        [_prevButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20*wl);
            make.centerY.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(50*wl, 30*hl));
        }];
        [_nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_right).offset(-20*wl);
            make.centerY.equalTo(self);
            make.size.equalTo(_prevButton);
        }];
        [_pageLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(50*wl, 30*hl));
        }];
        [_prevButton.titleLabel setFont:TEXT_FONT];
        [_nextButton.titleLabel setFont:TEXT_FONT];
        [_pageLable setFont:TEXT_FONT];
        [_prevButton setTitle:@"上一页" forState:UIControlStateNormal];
        [_nextButton setTitle:@"下一页" forState:UIControlStateNormal];
        [_prevButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_nextButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_prevButton addTarget:self action:@selector(buttonDidSelected:) forControlEvents:UIControlEventTouchUpInside];
        [_nextButton addTarget:self action:@selector(buttonDidSelected:) forControlEvents:UIControlEventTouchUpInside];

    }
    return self;
}

- (void)buttonDidSelected:(UIButton *)button{
    self.buttonSelectedBlock(button.titleLabel.text);
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
